Skip to content

lxd/network_forwards: Remove duplicate query param retrievals#18085

Merged
tomponline merged 1 commit intomainfrom
copilot/fix-error-handling-util
Apr 9, 2026
Merged

lxd/network_forwards: Remove duplicate query param retrievals#18085
tomponline merged 1 commit intomainfrom
copilot/fix-error-handling-util

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

Removes duplicate request.QueryParam(r, "target") calls in networkForwardGet and networkForwardPut, reusing the target variable already retrieved earlier in each function for the forwardedResponseToNode call.

Also reverts an incorrect error-handling pattern introduced for util.IsRecursionRequest in networkForwardsGet — the function returns (int, []string), not (int, error), so the second return value is correctly discarded with _.

Checklist

Copilot AI changed the title [WIP] Fix error handling for recursion request check lxd/network_forwards: Fix error handling and remove duplicate query param retrievals Apr 9, 2026
Copilot AI requested a review from kadinsayani April 9, 2026 15:14
@kadinsayani kadinsayani force-pushed the copilot/fix-error-handling-util branch from 7cc7201 to 8ee954d Compare April 9, 2026 15:31
@kadinsayani kadinsayani requested a review from simondeziel April 9, 2026 15:32
@kadinsayani kadinsayani marked this pull request as ready for review April 9, 2026 15:32
@kadinsayani kadinsayani changed the title lxd/network_forwards: Fix error handling and remove duplicate query param retrievals lxd/network_forwards: Remove duplicate query param retrievals Apr 9, 2026
@kadinsayani kadinsayani requested a review from tomponline April 9, 2026 15:36
@simondeziel
Copy link
Copy Markdown
Member

Copilot quality fix.

@copilot That's a shame that you couldn't link to the actual https://github.com/canonical/lxd/security/quality/ai-findings findings that you are addressing here. Making them link-able would be a nice product improvement if you can relay that kind of feedback ;)

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 9, 2026

Copilot quality fix.

@copilot That's a shame that you couldn't link to the actual https://github.com/canonical/lxd/security/quality/ai-findings findings that you are addressing here. Making them ...

Agreed, that would be a useful improvement! Unfortunately, the current tooling doesn't surface the finding URL to me when generating the PR description, so I cannot include it automatically. I'll relay the feedback.

Copilot AI requested a review from simondeziel April 9, 2026 17:09
Copy link
Copy Markdown
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ta

@tomponline tomponline merged commit be66f47 into main Apr 9, 2026
69 of 71 checks passed
@tomponline tomponline deleted the copilot/fix-error-handling-util branch April 9, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants